<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>节点属性操作</title>
</head>
<body>
<img src="1.png" alt="desktop" title="desktop.png"> <br>
<button>上一张</button>
<button>下一张</button>

<script>
    var img = document.getElementsByTagName("img")[0]
    console.log(img)
    // 获取图片的属性值  src
    console.log(img.src)
    console.log(img.alt)
    console.log(img.title)

    // 修改图片节点的src属性值
    img.src = '2.png'
    img.alt = 'new_desktop'
    img.title = 'new_title'

</script>
</body>
</html>